#include "LogicClear.h"

string LogicClear::clearTask(vector<Task>& tasksVector, Data* _data, Writer* _writer) {
	
	string statusMessage;
	Data::DataFeedback dataFeedback;
	vector<Task> tasks;

	dataFeedback = _data->executeClear();

	tasksVector.clear();

	if( dataFeedback == Data::SUCCESS ) {
		_data->getAll(tasks);
		_writer->write(tasks);
		statusMessage = CLEAR_SUCCESS_MESSAGE;
	} else {
		statusMessage = CLEAR_ERROR_MESSAGE;
		// logErrors(statusMessage, _undoState);
	}

	return statusMessage;
}

const string LogicClear::CLEAR_SUCCESS_MESSAGE = "File Contents Cleared";

const string LogicClear::CLEAR_ERROR_MESSAGE = "File Is Empty";